//
//  HederView.m
//  UIA段项目 墨家天气
//
//  Created by dllo on 15/8/20.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "HederView.h"
#import "URL.h"

@implementation HederView


-(void)dealloc
{
    [_timeLable release];
    [_date release];
    [_tempratureLable release];
    [_shidu release];
    [_baifenhao release];
    [_wind release];
    [_sky release];
    [_du release];
    [_score release];
    [_buttonYesterday release];
    [_buttonToday release];
    [_buttonTomday release];
    [_buttonHouday release];
    [_buttonDahouday release];
    
    [super dealloc];
    
   
    
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.aWeakArr = [NSMutableArray array];
        self.date = [[UILabel alloc]init];
        self.date.backgroundColor = [UIColor blackColor];
        self.date.textColor = [UIColor grayColor];
        
        

        self.date.font = [UIFont fontWithName:@"AllHookedUp" size:20 * OffWidth];
        self.date.backgroundColor = [UIColor clearColor];
        self.date.textColor = [UIColor whiteColor];
        [self addSubview:_date];
        
        
        self.tempratureLable = [[UILabel alloc]init];
        self.tempratureLable.textColor =  [[UIColor whiteColor] colorWithAlphaComponent:0.8];
        
        

//        self.tempratureLable.font = [UIFont fontWithName:@"AllHookedUp" size:150 * OffWidth];
        self.tempratureLable.font = [UIFont systemFontOfSize:150 * OffWidth];
        
        [self addSubview:_tempratureLable];
        
        
        self.du = [[UILabel alloc]init];
        self.du.textColor = [UIColor whiteColor];
        self.du.font = [UIFont boldSystemFontOfSize:80];
        [self addSubview:_du];
        
        
        
        self.wind = [[UILabel alloc]init];
        self.wind.textColor = [UIColor whiteColor];
        self.wind.font = [UIFont boldSystemFontOfSize:16 * OffWidth];
        [self addSubview:_wind];
        
        
        
        self.shidu = [[UILabel alloc]init];
        self.shidu.textColor = [UIColor whiteColor];
//        self.shidu.font = [UIFont boldSystemFontOfSize:16* OffWidth];
        self.shidu.font = [UIFont fontWithName:@"AllHookedUp" size:16 * OffWidth];

        [self addSubview:_shidu];
        
        
              
               
        self.sky = [[UILabel alloc]init];
        self.sky.textColor = [UIColor whiteColor];
        self.sky.layer.cornerRadius = 5;
        self.sky.textAlignment = 1;
        self.sky.layer.masksToBounds = YES;
        self.sky.font = [UIFont boldSystemFontOfSize:15* OffWidth];
        [self addSubview:_sky];
        
        self.weakSc = [[UIScrollView alloc]init];
        self.weakSc.pagingEnabled = YES;
        self.weakSc.contentSize = CGSizeMake(126 * OffWidth * 5, 0);
        self.weakSc.showsHorizontalScrollIndicator = NO;
        self.weakSc.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self addSubview:_weakSc];
        
        
        
        self.buttonYesterday = [[MyButton alloc]init];
        self.buttonYesterday.backgroundColor = [UIColor clearColor];
        self.buttonYesterday.layer.borderColor = [UIColor grayColor].CGColor;
        self.buttonYesterday.weak.textColor = [UIColor whiteColor];
        [_buttonYesterday addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        [self.weakSc addSubview:_buttonYesterday];
        
        
        
        self.buttonToday = [[MyButton alloc]init];
        self.buttonToday.backgroundColor = [UIColor clearColor];
        self.buttonToday.weak.textColor = [UIColor whiteColor];
        self.buttonToday.layer.borderColor = [UIColor grayColor].CGColor;
        [_buttonToday addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        [self.weakSc addSubview:_buttonToday];
        
        
        self.buttonTomday = [[MyButton alloc]init];
        self.buttonTomday.backgroundColor = [UIColor clearColor];
        self.buttonTomday.layer.borderColor = [UIColor grayColor].CGColor;
        self.buttonTomday.weak.textColor = [UIColor whiteColor];
        [_buttonTomday addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        [self.weakSc addSubview:_buttonTomday];
        
        
        self.buttonHouday = [[MyButton alloc]init];
        self.buttonHouday.backgroundColor = [UIColor clearColor];
        self.buttonHouday.layer.borderColor = [UIColor grayColor].CGColor;
        self.buttonHouday.weak.textColor = [UIColor whiteColor];
        [_buttonHouday addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        [self.weakSc addSubview:_buttonHouday];
        
        
        self.buttonDahouday = [[MyButton alloc]init];
        self.buttonDahouday.backgroundColor = [UIColor clearColor];
        [_buttonDahouday addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        self.buttonDahouday.layer.borderColor = [UIColor grayColor].CGColor;
        self.buttonDahouday.weak.textColor = [UIColor whiteColor];
        [self.weakSc addSubview:_buttonDahouday];
        
        
        self.score = [[UILabel alloc]init];
        self.score.layer.masksToBounds = YES;
        self.score.layer.cornerRadius = 5;
        self.score.textAlignment = 1;
        self.score.font = [UIFont systemFontOfSize:15 * OffWidth];
        self.score.textColor = [UIColor whiteColor];
        [self addSubview:_score];
        
        
        
        self.lineLable = [[UILabel alloc]init];
        self.lineLable.backgroundColor = [UIColor grayColor];
        [self addSubview:_lineLable];
     
        
        for (int i = 0; i < 4; i ++) {
            self.lineOnScLable = [[UILabel alloc]init];
            self.lineOnScLable.backgroundColor = [UIColor grayColor];
            self.lineOnScLable.frame = CGRectMake(125 * OffWidth *(i + 1), 30 * OffHeight, 1, 50 * OffHeight);
            [self.weakSc addSubview: _lineOnScLable];
            
            
        }
        
        
        
    }
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.date.frame = CGRectMake(self.frame.size.width - 150 * OffWidth, 120 * OffHeight, 150 * OffWidth, 30 * OffHeight) ;
    self.tempratureLable.frame = CGRectMake(10 * OffWidth, self.frame.size.height - 370 * OffHeight, 200 * OffWidth, 200 * OffHeight);
    self.wind.frame = CGRectMake(15 * OffWidth, self.frame.size.height - 152 * OffHeight, 125 * OffWidth, 30 * OffHeight);
    self.shidu.frame = CGRectMake(80 * OffWidth,self.frame.size.height - 150 * OffHeight, 50 * OffWidth, 30 * OffHeight);
    self.sky.frame = CGRectMake(10 * OffWidth, self.frame.size.height - 180 * OffHeight, 50 * OffWidth, 18 * OffHeight);
    self.weakSc.frame = CGRectMake(0, self.frame.size.height - 120 * OffHeight, self.frame.size.width, 118 * OffHeight);
    self.score.frame = CGRectMake(80 * OffWidth, self.frame.size.height - 180 * OffHeight, 70 * OffWidth, 18 * OffHeight);

       
    
    self.buttonYesterday.frame = CGRectMake(0, 0, (self.frame.size.width - 5 * OffWidth) / 3, 100 * OffHeight);
    self.buttonToday.frame = CGRectMake(self.frame.size.width / 3 * 1, 0, (self.frame.size.width - 5) / 3, 100 * OffHeight);
    self.buttonTomday.frame = CGRectMake(self.frame.size.width / 3 * 2, 0, (self.frame.size.width - 5) / 3, 100 * OffHeight);
    self.buttonHouday.frame = CGRectMake(self.frame.size.width / 3 * 3, 0, (self.frame.size.width - 5) / 3, 100 * OffHeight);
    self.buttonDahouday.frame = CGRectMake(self.frame.size.width / 3 * 4, 0, (self.frame.size.width - 5) / 3, 100 * OffHeight);

    self.lineLable.frame = CGRectMake(0, self.frame.size.height - 120 * OffHeight, self.frame.size.width, 0.7 * OffHeight);
    
    self.du.frame =  CGRectMake(160 * OffWidth, self.frame.size.height - 370 * OffHeight, 40 * OffWidth, 40 * OffHeight);
}
- (void)click:(UIButton *)button
{
    [self.delegate GoTo];
}


@end
